<template>
  <div>
    <!-- 顶部照片 -->
    <div class="top_img">
      <img
        src="https://imgservices-1252317822.image.myqcloud.com/coco/s05112022/45374c9c.a7wgjq.png"
        alt=""
      />
    </div>
    <!-- 登录注册 -->
    <div class="login_wrap">
      <div class="item">
        <i></i>
        <input type="text" placeholder="请输入邮箱/个性账号" v-model="phone" />
      </div>
      <div class="item">
        <i></i>
        <input type="password" placeholder="请输入密码" v-model="password" />
        <i class="eye"></i>
      </div>
      <div class="text">
        <div class="left">忘记密码</div>
        <div class="right">用户注册</div>
      </div>
      <p>
        登录即代表同意 <a href="">《用户服务协议》</a> 和
        <a href="">《隐私政策》</a>
      </p>
      <div class="login" @click="submit">登录</div>
      <div class="login-btn-wrap">
        <div class="login_method">
          <div class="img">
            <img
              src="https://sta.gtimg.com/mobile/static/images/qq.svg"
              alt=""
            />
          </div>
          <p>QQ</p>
        </div>
        <div class="login_method">
          <div class="img">
            <img
              src="https://sta.gtimg.com/mobile/static/images/phone.svg"
              alt=""
            />
          </div>
          <p>短信登录</p>
        </div>
        <div class="login_method">
          <div class="img">
            <img
              src="https://sta.gtimg.com/mobile/static/images/more.svg"
              alt=""
            />
          </div>
          <p>更多</p>
        </div>
      </div>
    </div>
    <!-- 底部照片 -->
    <div class="login_bottom">
      <div class="img">
        <img
          src="https://imgservices-1252317822.image.myqcloud.com/coco/s05112022/d9cb0fce.iczfxy.png"
          alt=""
        />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      phone: "",
      password: "",
    };
  },
  methods: {
    
    submit() {
      let reg =
        /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
      let pass = /^[a-zA-Z0-9]\w{8,17}$/;
      if (!reg.test(this.phone) || !pass.test(this.password)) {
        //不正确处理
        this.$toast("请输入正确手机号码与密码");
        return;
      }
      window.localStorage.setItem("token", "token值");
      window.localStorage.setItem("userId", "13123123");
      this.$toast("登陆成功");
      this.$router.push("/userinfo");
    },
  },
};
</script>

<style lang="scss" scoped>
/* 顶部照片 */
.top_img {
  width: 100%;
  img {
    width: 100%;
    height: 73px;
  }
}
/* 登录注册 */
.login_wrap {
  padding: 0 31px;
  .item {
    display: flex;
    width: 100%;
    padding: 31px 0 15px 6px;
    border-bottom: 2px solid #f3f3f3;
    input {
      border: 0;
      flex: 1;
      font-size: 14px;
      color: #cccccc;
      margin-left: 21px;
    }
    i {
      display: block;
      width: 15px;
      height: 15px;
      background: url("../assets/img/login_head.gif") center center no-repeat;
      margin-top: 2px;
    }
    &:nth-child(2) {
      i {
        background: url("../assets/img/login_lock.gif") center center no-repeat;
      }
      .eye {
        margin-right: 16px;
        background: url("../assets/img/eye.gif") center center no-repeat;
      }
    }
  }
  .text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #0091de;
    padding: 18px 0 28px 0;
  }
  p {
    font-size: 12px;
    color: #61708f;
    a {
      color: #2581fa;
    }
  }
  .login {
    width: 100%;
    text-align: center;
    height: 46px;
    line-height: 46px;
    font-size: 15px;
    color: #fff;
    background-color: #f47e83;
    border: 1px solid #fef3f4;
    border-radius: 20px;
    margin-top: 23px;
  }
  .login-btn-wrap {
    display: flex;
    justify-content: center;
    padding: 28px 0 36px 0;
    .login_method {
      &:nth-child(2) {
        margin: 0 29px;
      }
      p {
        text-align: center;
        margin-top: 18px;
        font-size: 13px;
        color: #61708f;
      }
      .img {
        img {
          width: 47px;
          height: 47px;
        }
      }
    }
  }
}
/* 底部照片 */
.login_bottom {
  width: 100%;
  position: fixed;
  bottom: 0;
  .img {
    img {
      width: 100%;
    }
  }
}
</style>
